#ifndef __QUEUE
#define __QUEUE

#include "..\Streams\Stream.h"

class Queue
{
private:
	packet * m_queue;
public:
	Queue()
	{
		m_queue = new packet();
		m_queue = m_queue->next = m_queue->last = NULL;
	}
	~Queue() {}

	void push(packet * p)
	{
		if (m_queue == NULL)
		{
			m_queue = p;
			m_queue->next = m_queue->last = NULL;
		}
		else if (m_queue->next == NULL)
		{
			m_queue->next = m_queue->last = p;
			m_queue->last->next = NULL;
		}
		else
		{
			m_queue->last->next = p;
			m_queue->last = m_queue->last->next;
			m_queue->last->next = NULL;
		}
	}

	packet * pop()
	{
		if (m_queue == NULL)
			return NULL;
		packet * t;
		t = m_queue;
		m_queue = this->m_queue->next;
		return t;
	}


};



#endif